{% extends "base.html" %}


{% block content %}
<div class="container">
    {# searchbox and text#}
    <div class="row mb-4 fade-in">
        <div class="col">
            <h3 class="display-4 fw-bold text-primary mb-0">Files Manage</h3>
            <p class="text-secondary mb-0">Browse and manage your documents</p>
        </div>
        <div class="col">
            <div class="input-group mb-3">
                {% if search_keyword %}
                <input type="text" class="form-control search_box" placeholder="Search files..."
                       aria-label="Search files" aria-describedby="button-search" value={{search_keyword}}>
                {% else %}
                <input type="text" class="form-control search_box" placeholder="Search files..."
                       aria-label="Search files" aria-describedby="button-search">
                {% endif %}
                <button class="btn" type="button" id="button-search" onclick="search_file()">
                    <i class="bi bi-search"></i>
                </button>
            </div>
        </div>
    </div>

    <div class="table-responsive">
        {# table #}
        <table class="table">
            <thead>
            <tr>
                <th>Name</th>
                <th>Size</th>
                <th>Team</th>
                <th>Project</th>
                <th>Uploader</th>
                <th>Actions</th>
            </tr>
            </thead>
            <tbody>

            {% for item in db_result %}
            <tr>
                <td>{{item.file_name}}
                    <br>
                    <span style="font-size: 12px">
                        upload time：{{item.upload_time}}
                    </span>
                </td>
                <td>{{item.file_size}}</td>
                <td>{{item.team_name}}</td>
                <td>{{item.project_name}}</td>
                <td>{{item.username}}</td>
                <td>
                    <button class="btn btn-primary btn-sm">
                        <a class="nav-link" href="/detail?file_name={{item.file_name}}">
                            <i class="bi bi-eye-fill"></i>View
                        </a>
                    </button>
                    <button class="btn btn-primary btn-sm">
                        <a class="nav-link" href="">
                            <i class="bi bi-box-arrow-in-down"></i>Load
                        </a>
                    </button>
                    <button class="btn btn-danger btn-sm">
                        <a class="nav-link" href="">
                            <i class="bi bi-trash"></i>delete
                        </a>
                    </button>
                </td>
            </tr>
            {% endfor %}


            </tbody>
        </table>
        {# pagination #}
        <nav aria-label="Page navigation">
            <ul class="pagination">
                <li class="page-item">
                    <a class="page-link" href="#" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                <li class="page-item active"><a class="page-link" href="#">1</a></li>
                <li class="page-item"><a class="page-link" href="#">2</a></li>
                <li class="page-item"><a class="page-link" href="#">3</a></li>
                <li class="page-item">
                    <a class="page-link" href="#" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </ul>
        </nav>
    </div>
</div>
{% endblock  %}

{% block footer %}
<script type="text/javascript" src="/js/home.js"></script>
{% endblock %}

